<?php

function module_post_activate($params)
{
	$dbAdapter = Euso_Db_Table_Abstract::getDefaultAdapter();
	$dbPrefix = Euso_Db_Table_Abstract::getTablePrefix();

	$tableList = $dbAdapter->listTables();

	if (in_array($dbPrefix .'post_entries', $tableList) === FALSE) {
		$queryString = file_get_contents(dirname(__FILE__) .'/install/mysql.sql');
		//TODO: don't use explode!
		$array = explode(';', $queryString);
		foreach ($array as $q) {
			$q = str_replace('{DB_TABLE_PREFIX}', $dbPrefix, trim($q));
			if (empty($q)) {
				continue;
			}
			$dbAdapter->query($q);
		}
	}

	return TRUE;
}

function module_post_deactivate($params)
{
	return TRUE;
}
